/*
 * 编辑用户
 */
define(function(require, exports, module) {
    require("common/umei.dev");
    // var form = require("common/umei.form");
    // var ajax = require("common/umei.ajax");
    // var umei_dialog = require("common/umei.dialog");
    var userId = $("#userId").val();

    var url = "user_add.do";
    if (userId != "") {
	url = "user_update.do";
    }
    umei.initForm({
	formObj : $("#user_form")
    });
    $("#saveBtn").click(function() {
	if (umei.verification({
	    formObj : $("#user_form")
	})) {
	    var data = $("#user_form").serialize();
	    umei.postRequest({
		async : true, url : url, data : data, fun : function(response) {
		    umei.tipMsg({
			type : "success", content : "保存成功", timeout : 1500, fun : function() {
			    document.location.href = "user_list.do";
			}
		    });
		}
	    });
	}
    });
});
